From: Jonas Dreßler Date: Sun, 31 May 2020 20:48:28 +0000 (+0200) Subject: workspace: Implement windowCenter using bounding box X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~312 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a2545d186aa1742db058a4f3982b57e59669e7d1;p=gnome-shell.git workspace: Implement windowCenter using bounding box This isn't quite the same as the allocation, but it's what the workspace actually wants to use given that we use the bounding box of the WindowClone for all the layout calculation. So instead of calculating the windowCenter in the WindowClone, make use of the bounding-box property of the layout manager and return the center point of that. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1297 --- diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 03b4edb3d..d58114dfc 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -222,8 +222,6 @@ var WindowClone = GObject.registerClass({ this.x = this.boundingBox.x; this.y = this.boundingBox.y; - this._computeWindowCenter(); - let clickAction = new Clutter.ClickAction(); clickAction.connect('clicked', this._onClicked.bind(this)); clickAction.connect('long-press', this._onLongPress.bind(this)); @@ -328,12 +326,9 @@ var WindowClone = GObject.registerClass({ } get windowCenter() { - return this._windowCenter; - } + const box = this.layout_manager.bounding_box; - _computeWindowCenter() { - let box = this.realWindow.get_allocation_box(); - this._windowCenter = new Graphene.Point({ + return new Graphene.Point({ x: box.get_x() + box.get_width() / 2, y: box.get_y() + box.get_height() / 2, });